package org.hackystat.app.projectstatus.data;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;


import junit.framework.TestCase;

/**
 * Implements Unit Testing for the data manager and collection
 * of daily project data.
 * 
 * @author Josh Stupplebeen
 *
 */
public class TestdpdData extends TestCase {


	/**
	 * Asserts whether the daily project data returned by the data
	 * manager for a particular day matches the strings which should
	 * be returned.
	 *
	 */
  public void testdpdData() {
	  
	  ProjectStatusDataManager dataManager = ProjectStatusDataManager.getInstance();
    
    try {
      List<String> htmlFileData = new ArrayList<String>();
      List<String> textFileData = new ArrayList<String>();
      File htmlfile = new File("c:\\dpd2.html");
      File textfile = new File("c:\\dpd.txt");
      BufferedReader htmlbr = new BufferedReader(new FileReader(htmlfile));
      BufferedReader textbr = new BufferedReader(new FileReader(textfile));
      htmlFileData = ProjectStatusDataManager.getFileStringList(htmlbr);
      textFileData = ProjectStatusDataManager.getFileStringList(textbr);
      String htmlFileString = dataManager.listToString(htmlFileData);
      
//      String htmlFileString = ProjectStatusHTMLEmail.getFileString(list);
      
      htmlFileString = htmlFileString.replaceFirst("@title", "somethingelse");
      htmlFileString = htmlFileString.replaceFirst("@data", "otherdata");
      System.out.println(htmlFileString);
      
//      System.out.println(ProjectStatusHTMLEmail.listToString(htmlFileData));
    }
    catch (FileNotFoundException fnf) {
    	System.out.println("File");
    }
  }
  
  
}
